<template>
	<view class="content">
		<u-toast ref="uToast" />
		<view class="zonghe">
			<view class="zonghe-title">
				<text style="font-size:35rpx;">单曲</text>
				<view @tap="send()">
					<image src="../../static/icon/plays.png" mode=""></image>
					<text>播放</text>
				</view>
			</view>
			<view class="zonghe-content" v-for="(item,index) in getdanqu" :key="index">
				<view class="zhonghemsg" @tap="Bfdanqu(item.id,item)">
					<text>{{item.name}}</text>
					<text>{{item.ar[0].name}}-{{item.al.name}}</text>
				</view>
				<view class="zhonghepic">
					<image @click="sendmv(item)" v-if="item.mv !== 0 " class="ic1" src="../../static/index-select.png">
					</image>
					<image class="ic2" src="../../static/icon/searchdiandian1.png" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		Mymusic,
		getAll
	} from '../../network/search2.js'
	import moment from 'moment'
	export default {
		data() {
			return {
				songlist: [],
				list: {}
			}
		},
		props: ['getdanqu'],
		methods: {
			sendmv(item) {
				uni.navigateTo({
					url: '../Mv/Mv?id=' + item.mv
				})
				console.log(123);
			},
			Bfdanqu(id, item) {
				Mymusic(id, item).then(res => {
					console.log(item);
					this.$store.commit('getmusicurl', res.data[0])
					let arr = []
					const name = item.name
					const authorId = item.al.id
					const author = item.ar[0].name
					const pic = item.al.picUrl
					const mv = item.mv
					const dt = this.$moment(item.dt).format('mm:ss')
					let newarr = arr.concat(name, author, pic, mv, authorId, dt)
					this.$store.commit('getmusicmsg', newarr)
					this.$store.commit('getfalg', true)

				})
			},

		},
		onLoad() {
			this.Bfdanqu()
		}
	}
</script>

<style scoped lang="scss">
	.zonghe {
		border-top-left-radius: 10px;
		border-top-right-radius: 10px;
		padding: 10rpx 30rpx;
		background-color: #fff;
		box-sizing: border-box;
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;

		.zonghe-title {
			border-bottom: 1px solid #EBEBEB;
			padding: 10px 0;
			display: flex;
			justify-content: space-between;
			align-items: center;

			view {
				display: flex;
				align-items: center;
				padding: 5rpx 10rpx;
				-webkit-box-sizing: border-box;
				-moz-box-sizing: border-box;
				box-sizing: border-box;
				border: 1px solid #ccc;
				border-radius: 10px;

				image {
					width: 12px;
					height: 12px;
				}

				text {
					font-size: 20rpx;
				}
			}
		}
	}

	.zonghe-content {
		border-bottom: 1px solid #EBEBEB;
		display: flex;
		justify-content: space-between;
		padding: 20rpx 0;
		align-items: center;

		.zhonghesongs {
			color: black;
			font-weight: 600;
		}

		.zhonghemsg {
			display: flex;
			flex-direction: column;
		}

		.zhonghepic {
			display: flex;

			image {
				width: 20px;
				margin: 0 10rpx;
				height: 20px;
			}
		}
	}
</style>
